package com.bokee.archerwq.lab.classloader;

/**
 * 
 * @author wangqiang
 * 
 */
public class Greet {

	@SuppressWarnings("rawtypes")
	public static void main(String[] args) {
		if (args.length <= 1) {
			System.out.println("Please input the base path and Greeters!");
			return;
		}

		GreeterClassLoader gcl = new GreeterClassLoader(args[0]);
		for (int i = 1; i < args.length; i++) {
			try {
				Class c = gcl.loadClass(args[i]);
				System.out.println("=======>" + c.getClassLoader().getParent());
				Object o = c.newInstance();
				Greeter greeter = (Greeter) o;
				greeter.greet();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		System.out.println(gcl.getParent().getClass().getName());
	}

}
